xen, cpupools: Fix cpupool-move to make more consistent
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Tue, 10 Apr 2012 09:42:35 +0000 (10:42 +0100)
committerGeorge Dunlap <george.dunlap@eu.citrix.com>
Tue, 10 Apr 2012 09:42:35 +0000 (10:42 +0100)
commitdbfa7bba0f213b1802e1900b71bc34837c30ee52
tree611b2cca35a792dfe9da22ae1bb39935414dbd30
parent7d302763ac7b0ecefb437ea45ee5b8d27a20d016
xen, cpupools: Fix cpupool-move to make more consistent

The full order for creating new private data structures when moving
from one pool to another is now:
* Allocate all new structures
 - Allocate a new private domain structure (but don't point there yet)
 - Allocate per-vcpu data structures (but don't point there yet)
* Remove old structures
 - Remove each vcpu, freeing the associated data structure
 - Free the domain data structure
* Switch to the new structures
 - Set the domain to the new cpupool, with the new private domain
 structure
 - Set each vcpu to the respective new structure, and insert

This is in line with a (fairly reasonable) assumption in credit2 that
the private structure of the domain will be the private structure
pointed to by the per-vcpu private structure.

Also fix a bug, in which insert_vcpu was called with the *old* vcpu
ops rather than the new ones.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen/common/schedule.c